package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
public class Competitor {
    private int competitorId;
    private  String competitorTitle;
    private String competitionCompany;
    private CompetingProducts competitorProduct;
    private BigDecimal competitorPrice;
    private String competitorAbility;
    private String advantage;
    private String inferiority;
    private String strategy;
    private Timestamp competitorTime;
    private BusinessInfo businessInfoByBusinesId;
    private Customer customerByCustomId;
    private String competitorStatus;
    private  Emp competitorEmp;

    @ManyToOne
    @JoinColumn(name="competitor_emp",referencedColumnName = "employees_id")
    public Emp getCompetitorEmp() {
        return competitorEmp;
    }

    public void setCompetitorEmp(Emp competitorEmp) {
        this.competitorEmp = competitorEmp;
    }

    @Id
    @Column(name = "competitor_id")
    public int getCompetitorId() {
        return competitorId;
    }

    public void setCompetitorId(int competitorId) {
        this.competitorId = competitorId;
    }

    @Basic
    @Column(name = "competitor_title")
    public String getCompetitorTitle() {
        return competitorTitle;
    }

    public void setCompetitorTitle(String competitorTitle) {
        this.competitorTitle = competitorTitle;
    }

    @Basic
    @Column(name = "competition_company")
    public String getCompetitionCompany() {
        return competitionCompany;
    }

    public void setCompetitionCompany(String competitionCompany) {
        this.competitionCompany = competitionCompany;
    }

    @ManyToOne
    @JoinColumn(name="competitor_product",referencedColumnName = "com_products_id")
    public CompetingProducts getCompetitorProduct() {
        return competitorProduct;
    }

    public void setCompetitorProduct(CompetingProducts competitorProduct) {
        this.competitorProduct = competitorProduct;
    }

    @Basic
    @Column(name = "competitor_price")
    public BigDecimal getCompetitorPrice() {
        return competitorPrice;
    }

    public void setCompetitorPrice(BigDecimal competitorPrice) {
        this.competitorPrice = competitorPrice;
    }

    @Basic
    @Column(name = "competitor_ability")
    public String getCompetitorAbility() {
        return competitorAbility;
    }

    public void setCompetitorAbility(String competitorAbility) {
        this.competitorAbility = competitorAbility;
    }

    @Basic
    @Column(name = "advantage")
    public String getAdvantage() {
        return advantage;
    }

    public void setAdvantage(String advantage) {
        this.advantage = advantage;
    }

    @Basic
    @Column(name = "Inferiority")
    public String getInferiority() {
        return inferiority;
    }

    public void setInferiority(String inferiority) {
        this.inferiority = inferiority;
    }

    @Basic
    @Column(name = "strategy")
    public String getStrategy() {
        return strategy;
    }

    public void setStrategy(String strategy) {
        this.strategy = strategy;
    }

    @Basic
    @Column(name = "competitor_Time")
    public Timestamp getCompetitorTime() {
        return competitorTime;
    }

    public void setCompetitorTime(Timestamp competitorTime) {
        this.competitorTime = competitorTime;
    }

    @Basic
    @Column(name = "competitor_status")
    public String getCompetitorStatus() {
        return competitorStatus;
    }

    public void setCompetitorStatus(String competitorStatus) {
        this.competitorStatus = competitorStatus;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Competitor that = (Competitor) o;
        return competitorId == that.competitorId &&
                Objects.equals(competitionCompany, that.competitionCompany) &&
                Objects.equals(competitorPrice, that.competitorPrice) &&
                Objects.equals(competitorAbility, that.competitorAbility) &&
                Objects.equals(advantage, that.advantage) &&
                Objects.equals(inferiority, that.inferiority) &&
                Objects.equals(strategy, that.strategy) &&
                Objects.equals(competitorTime, that.competitorTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(competitorId, competitionCompany, competitorPrice, competitorAbility, advantage, inferiority, strategy, competitorTime);
    }

    @ManyToOne
    @JoinColumn(name = "busines_id", referencedColumnName = "busines_id")
    public BusinessInfo getBusinessInfoByBusinesId() {
        return businessInfoByBusinesId;
    }

    public void setBusinessInfoByBusinesId(BusinessInfo businessInfoByBusinesId) {
        this.businessInfoByBusinesId = businessInfoByBusinesId;
    }

    @ManyToOne
    @JoinColumn(name = "custom_id", referencedColumnName = "custom_id")
    public Customer getCustomerByCustomId() {
        return customerByCustomId;
    }

    public void setCustomerByCustomId(Customer customerByCustomId) {
        this.customerByCustomId = customerByCustomId;
    }

    @Override
    public String toString() {
        return "Competitor{" +
                "competitorId=" + competitorId +
                ", competitorTitle='" + competitorTitle + '\'' +
                ", competitionCompany='" + competitionCompany + '\'' +
                ", competitorProduct='" + competitorProduct + '\'' +
                ", competitorPrice=" + competitorPrice +
                ", competitorAbility='" + competitorAbility + '\'' +
                ", advantage='" + advantage + '\'' +
                ", inferiority='" + inferiority + '\'' +
                ", strategy='" + strategy + '\'' +
                ", competitorTime=" + competitorTime +
                ", businessInfoByBusinesId=" + businessInfoByBusinesId +
//                ", customerByCustomId=" + customerByCustomId +
                ", competitorStatus='" + competitorStatus + '\'' +
                '}';
    }
}
